package wili.attrMapping._user.b1;

/**
 * b1 constant list.
 */
public interface AttConst {

	public static String placeholderOf(String var) {
		return "@{" + var + "}";
	}

	String ctrlType = "ctrlType", HBox = "HBox", LABEL = "label", TEXT = "text";

	String LOCAL = new String[] { "en", "cn" }[1];

	interface AttAct {
		/**
		 * generate template.
		 */
		String genTemp = "genTemp";

		/**
		 * generate rule.
		 */
		String genRule = "genRule";

		String update = "updateTargetValue";

		String check = "check";
	}

	interface Bugs {
		String MappingToNotFound = "atts_has_no_targetMapping: ";

		String beforeUpdate = "beforeUpdate: ", afterUpdate = "_afterUpdate: ";

		String MapingFromNodeFound = "RuleNodeFound";

		String InconsistentMapping = "inconsistentMapping: ";

		public static String msg(Object... msgs) {
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < msgs.length; i++) {
				String msg = String.valueOf(msgs[i]);
				switch (msg) {
				case beforeUpdate:
					msg = LOCAL.equals("cn") ? "修改前：" : msg;
					break;
				case afterUpdate:
					msg = LOCAL.equals("cn") ? "修改后：" : msg;
					break;
				case InconsistentMapping:// 相同路径指向不同的规则叶
					msg = LOCAL.equals("cn") ? "不一致的映射：" : msg;
					break;
				case MapingFromNodeFound:// 旧属性不存在于规则中
					msg = LOCAL.equals("cn") ? "未发现能匹配属性集的规则: " : msg;
					break;
				case MappingToNotFound:
					msg = LOCAL.equals("cn") ? "属性集无映射目的：" : msg;
					break;
				default:
				}
				sb.append(msg);
			}
			return sb.toString();
		}
	}
}
